import request from '@/utils/request'

export function getData(params) {
  return request({
    url: '/rent/search',
    method: 'get',
    params
  })
}

export function addData(data) {
  return request({
    url: '/rent/add',
    method: 'post',
    data
  })
}

export function getRent(id) {
  return request({
    url: '/rent/' + id,
    method: 'get'
  })
}

export function editData(data) {
  return request({
    url: '/rent/edit',
    method: 'post',
    data
  })
}

export function huXingShiData() {
  return [
    { label: '所有', value: '0' },
    { label: '1室', value: '1' },
    { label: '2室', value: '2' },
    { label: '3室', value: '3' },
    { label: '4室', value: '4' },
    { label: '5室', value: '5' },
    { label: '6室', value: '6' },
    { label: '7室', value: '7' },
    { label: '8室', value: '8' },
    { label: '9室', value: '9' }
  ]
}

export function addHuXingShiData() {
  return [
    { label: '1室', value: '1' },
    { label: '2室', value: '2' },
    { label: '3室', value: '3' },
    { label: '4室', value: '4' },
    { label: '5室', value: '5' },
    { label: '6室', value: '6' },
    { label: '7室', value: '7' },
    { label: '8室', value: '8' },
    { label: '9室', value: '9' }
  ]
}

export function huXingTingData() {
  return [
    { label: '1厅', value: '1' },
    { label: '2厅', value: '2' },
    { label: '3厅', value: '3' },
    { label: '4厅', value: '4' },
    { label: '5厅', value: '5' },
    { label: '6厅', value: '6' },
    { label: '7厅', value: '7' },
    { label: '8厅', value: '8' },
    { label: '9厅', value: '9' }
  ]
}

export function huXingWeiData() {
  return [
    { label: '1卫', value: '1' },
    { label: '2卫', value: '2' },
    { label: '3卫', value: '3' },
    { label: '4卫', value: '4' },
    { label: '5卫', value: '5' },
    { label: '6卫', value: '6' },
    { label: '7卫', value: '7' },
    { label: '8卫', value: '8' },
    { label: '9卫', value: '9' }
  ]
}

export function priceData() {
  return [
    { label: '不限', value: '0' },
    { label: '<=1000', value: '1' },
    { label: '1000-1500', value: '2' },
    { label: '1500-2000', value: '3' },
    { label: '2000-2500', value: '4' },
    { label: '2500-3000', value: '5' },
    { label: '3000-5000', value: '6' },
    { label: '>=5000', value: '7' }
  ]
}

export function rulesForm() {
  return {
    rentName: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    acreage: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    rentOrientation: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    preserve: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    occupancy: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    floor: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    elevator: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    water: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    electricity: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    gas: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    phone: [
      { required: true, message: '请输入正确的手机号码', trigger: 'blur', pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/ }
    ],
    payment: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    rental: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    cashPledge: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    serviceFee: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    agencyFee: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    longitude: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    latitude: [
      { required: true, message: '必填项', trigger: 'blur' }
    ],
    pid: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    cid: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    aid: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    rentWay: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    toilet: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    hall: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    room: [
      { required: true, message: '必填项', trigger: 'change' }
    ],
    decorate: [
      { required: true, message: '必填项', trigger: 'change' }
    ]
  }
}
